package easy;

import java.util.Arrays;

/**
 * 最小和
 */
public class test6 {
    public static void main(String[] args) {
        test6 test6 = new test6();
        System.out.println(test6.splitNum(4325));
    }

    public int splitNum(int num) {
        Integer a = num;
        char[] charArray = a.toString().toCharArray();
        Arrays.sort(charArray);
        int b = 0, c = 0;
        for (int i = 0; i < charArray.length; i++) {
            if (i % 2 == 0) {
                b = b * 10 + (charArray[i] - '0');
            } else {
                c = c * 10 + (charArray[i] - '0');
            }
        }

        return b+c;
    }
}
